﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewTasks.aspx.cs" Inherits="Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Tasks.ViewTasks"
    MasterPageFile="~/CISFPortal_RightMenu.Master" %>

<%@ Register Assembly="CISFAjaxExtenders" Namespace="Microsoft.InformationSecurity.CISF.Web.AjaxExtenders"
    TagPrefix="cc2" %>
<%@ Register Src="../UserControls/SearchFilterControl.ascx" TagName="SearchFilterControl"
    TagPrefix="uc1" %>
<asp:Content ID="DefaultPageContent" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <br />
        <div class="progressPopup">
        <asp:UpdateProgress ID="uprProgress" runat="server" DisplayAfter="200">
            <ProgressTemplate>
                <table class="progressBar" width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="center" style="width: 30%">
                            <asp:Image ID="imgUpdateProgress" ImageUrl="~/Images/LineSpinner-blue.gif" runat="server" />&nbsp;
                        </td>
                        <td>
                            <asp:Label ID="lblWaitMessage" Text="Please wait while processing data..." CssClass="messageWait"
                                Font-Bold="true" runat="server"></asp:Label>
                        </td>
                    </tr>
                </table>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>
    <table border="0" cellpadding="0" cellspacing="0" width="1020px">
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td align="left" valign="middle" width="40">
                            <img src="../Images/Search-32.png" alt="View Tasks" />
                        </td>
                        <td valign="middle">
                            <asp:Label runat="server" ID="lblPageHeader" Text="" CssClass="labelPageheader"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <hr />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td valign="middle">
                <asp:Panel ID="Panel1" runat="server" GroupingText="Search">
                    <asp:UpdatePanel ID="pnlFilterQuery" runat="server">
                        <ContentTemplate>
                            <uc1:SearchFilterControl ID="searchFilterControl1" runat="server" SortFields="true"
                                BusinessObjectType="Tasks" OnSearchFilterSelected="searchFitlerControl1_SearchFilterSelected"
                                OnSearchFilterLoaded="searchFitlerControl1_SearchFilterLoaded" />
                            <asp:CheckBox ID="chkActiveTasks" runat="server" Checked="true" AutoPostBack="true"
                                OnCheckedChanged="chkActiveTasks_Checked" />Only display active tasks.
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="pnlFilterResults" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="lblResults" runat="server" Text=""></asp:Label>
                        <br />
                        <br />
                        <asp:GridView ID="gridResults" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            AllowPaging="True" OnPageIndexChanging="gridResults_PageIndexChanging" OnRowDataBound="gridResults_RowDataBound"
                            OnSorting="gridResults_Sorting" DataSourceID="tasksSource" CssClass="table" PageSize="10">
                            <PagerSettings Mode="Numeric" PageButtonCount="8" Position="TopAndBottom" />
                            <PagerStyle HorizontalAlign="Right" />
                            <AlternatingRowStyle CssClass="alternate" />
                            <Columns>
                                <asp:TemplateField HeaderText="Actions" ItemStyle-Width="40">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" ID="lnkEdit" Visible="true" Text="Edit" NavigateUrl='<%#"~/Tasks/viewtask.aspx?taskid=" + ((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).ID.ToString() %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:Image runat="server" ID="imgWarning" Visible="false" AlternateText="This task is past its due date."
                                            Width="16" Height="16" ImageUrl="../images/warning.png" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Risk Title" Visible="false">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="RiskLink" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Common.Utility.TrimString(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).BusinessObject.Name,30)) %>'
                                            NavigateUrl='<%#"~/Risks/SubmitRisk.aspx?RiskID=" + ((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).BusinessObject.ID.ToString() %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Task Title" SortExpression="TaskTitle">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="TaskLink" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Common.Utility.TrimString(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).Name,30)) %>'
                                            NavigateUrl='<%#"~/Tasks/viewtask.aspx?taskid=" + ((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).ID.ToString() %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Assigned To" SortExpression="AssignedTo" ItemStyle-Width="150">
                                    <ItemTemplate>
                                        <asp:Label ID="AssignedToLabel" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).AssignedTo.Name) %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Due Date" SortExpression="DueDate">
                                    <ItemTemplate>
                                        <asp:Label ID="DueDateLabel" runat="server" Width="60" Text='<%#((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).DueDate.ToString("MM/dd/yyyy") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Category" SortExpression="TaskCategory">
                                    <ItemTemplate>
                                        <asp:Label ID="CategoryLabel" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).Category.Name) %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Group" SortExpression="TaskGroup" ItemStyle-Width="200">
                                    <ItemTemplate>
                                        <asp:Label ID="GroupLabel" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).Group.Name) %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Status" SortExpression="TaskStatus">
                                    <ItemTemplate>
                                        <asp:Label ID="StatusLabel" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.TasksService.Task)Container.DataItem).Status.Name) %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <PagerStyle HorizontalAlign="Right" />
                        </asp:GridView>
                        <asp:ObjectDataSource ID="tasksSource" runat="server" EnablePaging="True" SelectMethod="Select"
                            TypeName="Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Tasks.TaskDataSource"
                            SelectCountMethod="SelectCount" OnSelecting="tasksSource_Selecting"></asp:ObjectDataSource>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="searchFilterControl1" EventName="SearchFilterSelected" />
                        <asp:AsyncPostBackTrigger ControlID="chkActiveTasks" EventName="CheckedChanged" />
                    </Triggers>
                </asp:UpdatePanel>
                <br />
            </td>
        </tr>
    </table>
</asp:Content>
